#include <string.h>

char gameSecretNum[4];

//returns a array of bulls and cows, first byte being the bull, the second, the cow
void getBullsAndCows(char guess[4], char bullCow[2]){
  int i;
  char bulls=0x30,cows=0x30;

  //look for bulls and cows 
  for(i=0; i < 4; i++) {
    if ( gameSecretNum[i] == guess[i] ) {
      bulls++;
    } else if ( strchr(gameSecretNum, guess[i]) != NULL ) {
      cows++;
    }//end if
  }//end for

  bullCow[0] = bulls;
  bullCow[1] = cows;
}//end getBullsAndCows

//function to convert an int to an ASCII char value
char fromIntToASCII(int val){
  char ascii;

  switch(val){
    case 0:
      ascii = 0x30;
    break;
    case 1:
      ascii = 0x31;
    break;
    case 2:
      ascii = 0x32;
    break;
    case 3:
      ascii = 0x33;
    break;
    case 4:
      ascii = 0x34;
    break;
    case 5:
      ascii = 0x35;
    break;
    case 6:
      ascii = 0x36;
    break;
    case 7:
      ascii = 0x37;
    break;
    case 8:
      ascii = 0x38;
    break;
    case 9:
      ascii = 0x39;
    break;
    default:
      ascii = 0x3A;
      break;
  }//end switch
  return ascii;
}//end fromIntToASCII

